local card_extension = Package:new("kanncards", Package.CardPack)
card_extension.extensionName = "sifu_heg"
local H = require "packages/ol_hegemony/util"
local U = require "packages/utility/utility"
local S = require "packages/sifu_heg/SeaFunc"
Fk:loadTranslationTable{
    ["kanncards"]=  "不臣篇卡牌",
    }

--号令天下
local rule_the_worldSkill = fk.CreateActiveSkill{
  name = "rule_the_world_skill",
  prompt = "#rule_the_world_skill",
  target_num = 1,
  mod_target_filter = function(self, to_select, selected, user, card)
    if #selected == 0 then
      local n = 5
      for _, p in ipairs(Fk:currentRoom().alive_players) do
        if p.hp <= n then
          n = p.hp
        end
      end
      return Fk:currentRoom():getPlayerById(to_select).hp ~= n and to_select ~= user
    end
  end,
   target_filter = function(self, to_select, selected, _, card)
    if #selected == 0  then
      return self:modTargetFilter(to_select, selected, Self.id, card)
    end
  end,
  can_use = function(self, player, card)
    return not player:isProhibited(player, card) 
  end,
  on_effect=function(self,room,effect)
    local target = room:getPlayerById(effect.to)
    if not target.dead then
    local choices = {}
    table.insert(choices, "hltx_useslash")
    table.insert(choices, "hltx_discard")
    table.insert(choices, "Cancel")
    local targets = table.map(table.filter(room:getOtherPlayers(target), function(p)
      return p end), Util.IdMapper)
    room:sortPlayersByAction(targets)
    for _, pid in ipairs(targets) do
      local p = room:getPlayerById(pid)
      if not p.dead then
        local choice = room:askForChoice(p, choices, self.name)
        if choice == "hltx_useslash" then
            if p.kingdom ~= "wei" and not p:isKongcheng() then  --魏国不需要丢牌
              room:askForDiscard(p,1,1,false,self.name,false,nil,"#haolingtianxia-discard1")
            end
            room:useVirtualCard("slash", nil, p, target, self.name, false)
      end
      if choice == "hltx_discard" then
        if not  target:isKongcheng() then
          local cid = room:askForCardChosen(p, target, "he", self.name,"#haolingtianxia-discard2")
          room:throwCard({cid}, self.name, target, p)
          if p.kingdom == "wei" and not p.dead then  --如果魏国,可以获得那张牌
            room:obtainCard(p,cid,true,fk.ReasonPrey)
          end
        end
      end
      if choice == "Cancel" then
      end
        end
      end
    end
  end,
}
local rule_the_world = fk.CreateTrickCard{
  name = "heg_rule_the_world",
  suit = Card.Black,
  number = 12,
  skill = rule_the_worldSkill,

}
card_extension:addCard(rule_the_world)
Fk:loadTranslationTable{
  ["rule_the_world_skill"]="号令天下",
  ["#rule_the_world_skill"]="号令天下",
  ["heg_rule_the_world"]="号令天下",
  [":heg_rule_the_world"]="锦囊牌<br /><b>时机</b>：出牌阶段<br /><b>目标</b>：体力值不是最少的一名其他角色<br /><b>效果</b>：所有除其之外的角色可以选择一项：1.弃置一张手牌，视为"..
  "对其使用一张【杀】；2.弃置其一张牌。<br />魏：魏势力角色选择1时无需弃置牌，选择2时可以获得弃置的牌。<br />",
  ["hltx_useslash"]="弃置一张手牌，视为对其使用一张【杀】",
  ["hltx_discard"]="弃置其一张牌",
  ["#haolingtianxia-discard1"]="弃置一张手牌，视为对其使用一张【杀】",
  ["#haolingtianxia-discard2"]="弃置其一张牌",
}
--克服中原
local kefuzhongyuanSkill = fk.CreateActiveSkill{
  name = "kefuzhongyuan_skill",
  prompt = "#kefuzhongyuan_skill",
  min_target_num = 1,
  mod_target_filter =function(self, to_select, selected, user)
    return true
  end,
  target_filter = function(self, to_select, selected, _, card)
    if #selected == 0 then
      return self:modTargetFilter(to_select, selected, Self.id, card, false)
    else
      return self:modTargetFilter(to_select, selected, Self.id, card, false)
    end
  end,
  on_effect=function (self, room, effect)
    local player = room:getPlayerById(effect.from)
    local target = room:getPlayerById(effect.to)
    local choices ={}
    table.insert(choices, "kfzy_useslash")
    table.insert(choices, "kfzy_drawcards")
    local choice = room:askForChoice(target, choices, self.name)
    if choice == "kfzy_drawcards" then
      if target.kingdom =="shu" then
        target:drawCards(2,self.name)
      else
        target:drawCards(1,self.name)
            end
    end
    if choice == "kfzy_useslash" then
      local slash = Fk:cloneCard("slash")
      local max_num = slash.skill:getMaxTargetNum(target, slash)
      local targets = table.map(table.filter(room:getOtherPlayers(target), function(p)
        return target:inMyAttackRange(p) end), Util.IdMapper)
    if #targets == 0 or max_num == 0 then return end
      local tos = room:askForChoosePlayers(target, targets, 1, max_num, "#kefuzhongyuan-choose", self.name, true)
      if #tos >0 then
        if target.kingdom == "shu" then
          room:useCard({
          from = target.id,
          tos = table.map(tos, function(pid) return { pid } end),
          card = slash,
          extraUse = false,
          additionalDamage=1,
        })
      else
        room:useCard({
          from = target.id,
          tos = table.map(tos, function(pid) return { pid } end),
          card = slash,
          extraUse = false,
        })
      end
      end
      end
  end,
}
local kefuzhongyuan = fk.CreateTrickCard{
  name = "heg_kefuzhongyuan",
  suit = Card.Diamond,
  number = 1,
  skill = kefuzhongyuanSkill,
}
card_extension:addCard(kefuzhongyuan)
Fk:loadTranslationTable{
  ["heg_kefuzhongyuan"]="克复中原",
  ["kefuzhongyuan_skill"]="克复中原",
  ["#kefuzhongyuan_skill"]="选择任意名角色使用",
  [":heg_kefuzhongyuan"] = "锦囊牌<br /><b>时机</b>：出牌阶段<br /><b>目标</b>：任意名角色<br /><b>效果</b>：目标角色依次选择一项：1.视为使用一张【杀】；"..
  "2.摸一张牌。<br />蜀：蜀势力角色选择1时【杀】伤害+1，选择2时改为摸两张牌。<br />",
  ["#kefuzhongyuan-choose"]="克复中原：选择一名角色成为【杀】的目标",
  ["kfzy_useslash"] ="视为使用一张【杀】",
  ["kfzy_drawcards"] ="摸一张牌",
}
--固国安邦
local guguoanbangSkill = fk.CreateActiveSkill{
    name = "guguoanbang_skill",
    prompt = "#guguoanbang_skill",
    mod_target_filter = Util.TrueFunc,
    can_use = function(self, player, card)
      return not player:isProhibited(player, card)
    end,
    on_use = function(self, room, cardUseEvent)
      if not cardUseEvent.tos or #TargetGroup:getRealTargets(cardUseEvent.tos) == 0 then
        cardUseEvent.tos = { { cardUseEvent.from } }
      end
    end,
    on_effect = function(self, room, effect)
     local target = room:getPlayerById(effect.to)
      if target.dead then return end
      target:drawCards(8, self.name)
      if not  target:isKongcheng() then
      local nums = #target:getCardIds(Player.Hand)
      room:askForDiscard(target,6,nums,false,"guguoanbang_skill",false,nil,"guguoanbang-ask")
      end
      end,
}
local guguoanbang = fk.CreateTrickCard{
  name = "heg_guguoanbang",
  suit = Card.Heart,
  number = 1,
  skill = guguoanbangSkill,
}
card_extension:addCard(guguoanbang)
Fk:loadTranslationTable{
  ["heg_guguoanbang"]="固国安邦",
  ["guguoanbang_skill"]="固国安邦",
  ["#guguoanbang_skill"]="你摸八张牌，然后弃置至少六张手牌",
  [":heg_guguoanbang"] = "锦囊牌<br /><b>时机</b>：出牌阶段<br /><b>目标</b>：你<br /><b>效果</b>：目标角色摸八张牌，然后弃置至少六张手牌。<br />吴：你可以将以此法"..
  "弃置的牌交给吴势力角色，每名角色至多两张。（势力效果施工中）<br />",
  ["guguoanbang-ask"]="固国安邦：弃置至少六张手牌"
}
--文和乱武
local chaosSkill = fk.CreateActiveSkill{
   name = "zeheg_chaosSkill",
   prompt = "#zeheg_chaosSkill",
   can_use = Util.GlobalCanUse,
   on_use = Util.GlobalOnUse,
   mod_target_filter = Util.TrueFunc,
   about_to_effect = function(self, room, effect)
    if not room:getPlayerById(effect.to):isKongcheng() then
      return true
    end
  end,
  on_effect = function(self, room, effect)
    local player = room:getPlayerById(effect.from)
    local target = room:getPlayerById(effect.to)
    local cards = target:getCardIds("h")
    if not target.dead and not target:isKongcheng() then
      target:showCards(cards)
      local choices ={}
      table.insert(choices, "chaos_discard-self")
      table.insert(choices, "chaos_discard-others")
      local choice = room:askForChoice(player, choices, self.name)
      if choice == "chaos_discard-self" then  --自己弃牌
      local ids = room:askForDiscard(target, 1, 1, false, self.name, false, ".", "#whlw-discard1")
      if Fk:getCardById(ids[1]).type == Card.TypeTrick then
        room:askForDiscard(target, 1, 1, false, self.name, false, ".|.|.|.|.|basic,equip", "#whlw-discard2")
      end 
      if Fk:getCardById(ids[1]).type == Card.TypeBasic then
        room:askForDiscard(target, 1, 1, false, self.name, false, ".|.|.|.|.|trick,equip", "#whlw-discard2")
      end
      if Fk:getCardById(ids[1]).type == Card.TypeEquip then
        room:askForDiscard(target, 1, 1, false, self.name, false, ".|.|.|.|.|basic,trick", "#whlw-discard2")
      end
      if target.kingdom == "qun" and target:isKongcheng() then  
        local num = target.hp - target:getHandcardNum()
        if num > 0 then
          target:drawCards(num,self.name)
          end
      end
    end
      if choice =="chaos_discard-others" then  --别人弃牌
        if table.find(target:getCardIds("h"), function(id) return Fk:getCardById(id)  end) then
          local card, _ = U.askforChooseCardsAndChoice(player, table.filter(target:getCardIds("h"), function(id) return Fk:getCardById(id) end), 
          {"OK"}, self.name, "", nil, 1, 1, target:getCardIds("h"))
          room:throwCard(card, self.name, target, player)
        else
          U.viewCards(player, target:getCardIds("h"), self.name)
        end
        if target.kingdom == "qun" and target:isKongcheng() then
          local num = target.hp - target:getHandcardNum()
          if num > 0 then
            target:drawCards(num,self.name)
            end
        end
      end
    end
  end,

}


local chaos = fk.CreateTrickCard{
  name = "heg_chaos",
  suit = Card.Club,
  number = 12,
  skill = chaosSkill,
}
card_extension:addCard(chaos)
Fk:loadTranslationTable{
["heg_chaos"]="文和乱武",
[":heg_chaos"]="锦囊牌<br /><b>时机</b>：出牌阶段<br /><b>目标</b>：所有角色<br /><b>效果</b>：目标角色依次展示手牌,你选择一项：1.令其弃置两张类别各不同的手牌；2.你弃置其中一张牌。"..
  "<br />群：群势力角色执行效果后若没有手牌，则将手牌摸至体力值。",
["zeheg_chaosSkill"]="文和乱武",
["#zeheg_chaosSkill"]="文和乱武",
["chaos_discard-self"]="令其弃置两张类别各不同的手牌",
["#whlw-discard1"]="文和乱武：弃置一张手牌",
["#whlw-discard2"]="文和乱武：弃置一张手牌",
["chaos_discard-others"]="你弃置其中一张牌"
}

--诏书

local zhaoshu_base = fk.CreateActiveSkill{
  name = "zhaoshu_base",
  prompt = "#zhaoshu_base",
  mod_target_filter = Util.TrueFunc,
  can_use = function(self, player, card)
    return not player:isProhibited(player, card)
  end,
  on_use = function(self, room, cardUseEvent)
    if not cardUseEvent.tos or #TargetGroup:getRealTargets(cardUseEvent.tos) == 0 then
      cardUseEvent.tos = { { cardUseEvent.from } }
    end
  end,
  on_effect = function(self, room, effect)
    local target = room:getPlayerById(effect.to)
     if target.dead then return end
      room:handleAddLoseSkills(target, "zhaoshu_yuan")
      room:handleAddLoseSkills(target, "zhaoshu_get_card_skill")
    end,
}

local zhaoshu = fk.CreateTrickCard{
  name = "heg_zhaoshu",
  suit = Card.Club,
  number = 3,
  skill = zhaoshu_base,
}
Fk:loadTranslationTable{
  ["zhaoshu_base"] = "诏书",
  ["#zhaoshu_base"] = "诏书",
  ["heg_zhaoshu"] = "诏书",
  [":heg_zhaoshu"]="装备牌·宝物<br /><b>宝物技能</b>：当【敕令】移出游戏后，将【诏书】 置入牌堆底。"..
  "<br />与你势力相同的角色的出牌阶段限一次,其可以将一张(小势力角色改为至多两张)手牌置于【诏书】上。"..
  "<br />召唤：出牌阶段限一次，若【诏书】上有四张花色均不同的牌，你可以将【诏书】上所有的牌置入弃牌堆，然后随机获得一张势力锦囊。"..
  "<br />※此牌因使用而进入弃牌堆前，改为将此牌移出游戏。",
}
card_extension:addCard(zhaoshu)

local zhaoshu_yuan = fk.CreateTriggerSkill{ --诏书给队友加技能
  name = "zhaoshu_yuan",
  mute = true,
  visible = false,
  refresh_events = {fk.EventAcquireSkill, fk.EventLoseSkill, fk.Deathed, fk.GeneralRevealed, fk.GeneralHidden},
  can_refresh = function(self, event, target, player, data)
    if player ~= target then return false end
    if event == fk.Deathed then return player:hasSkill(self, true, true)
    elseif event == fk.EventAcquireSkill or event == fk.EventLoseSkill then return data == self
    else return true end
  end,
  on_refresh = function(self, event, target, player, data)
    local room = player.room
    local players = room.alive_players
    local zhaoshus = table.filter(players, function(p) return p:hasSkill(self) end)
    local zhaoshu_map = {}
    for _, p in ipairs(players) do
      local will_attach = false
      for _, zhaoshuyuan in ipairs(zhaoshus) do
        if ( H.compareKingdomWith(zhaoshuyuan, p)) then
          will_attach = true
          break
        end
      end
      zhaoshu_map[p] = will_attach
    end
  for p, v in pairs(zhaoshu_map) do
    if v ~= p:hasSkill("zhaoshu_other&") then
      room:handleAddLoseSkills(p, v and "zhaoshu_other&" or "-zhaoshu_other&", nil, false, true)
    end
  end
  end,
}
local zhaoshuother = fk.CreateActiveSkill{--队友的诏书技能
name = "zhaoshu_other&",
prompt = "#zhaoshu_other&",
anim_type = "support",
derived_piles = "zhaoshu_user",
min_card_num = 1,
max_card_num = 2,
can_use = function(self, player)
  return player:usedSkillTimes(self.name, Player.HistoryPhase) == 0 and table.find(Fk:currentRoom().alive_players, function(p)
    return p:hasSkill(zhaoshu_yuan) and H.compareKingdomWith(p, player)
  end)
end,
card_filter = function(self, to_select, selected)
  local player = Fk:currentRoom():getPlayerById(Self.id)
  if H.isBigKingdomPlayer(player) then
  return #selected == 0 and table.contains(Self:getHandlyIds(true), to_select)
  elseif H.isSmallKingdomPlayer(player)  then --小势力角色
    return #selected <= 1 and table.contains(Self:getHandlyIds(true), to_select)
  else --既不是大势力也不是小势力
    return #selected == 0 and table.contains(Self:getHandlyIds(true), to_select)
  end
end,
on_use = function(self, room, effect)
  local player = room:getPlayerById(effect.from)
  local tos = table.find(Fk:currentRoom().alive_players, function(p)
    return p:hasSkill(zhaoshu_yuan) and H.compareKingdomWith(p, player)
  end)
  if tos and tos:hasSkill("zhaoshu_get_card_skill") then
    tos:addToPile("zhaoshu_user", effect.cards, true, self.name)
  end
end,
}
Fk:loadTranslationTable{
  ["zhaoshu_yuan"] = "诏书",
  [":zhaoshu_yuan"] = "出牌阶段限一次，你可以将一张（若你为小势力角色，则改为两张）手牌置于【诏书】上。",
  ["zhaoshu_other&"] = "诏书",
  [":zhaoshu_other&"] = "出牌阶段限一次，你可以将一张（若你为小势力角色，则改为两张）手牌置于【诏书】上。",
  ["zhaoshu_user"] = "诏书",
  ["#zhaoshu_other&"] = "你可以将一张（若你为小势力角色，则改为两张）手牌置于【诏书】上",
}
--势力锦囊
local ruleworld= {{"heg_rule_the_world", Card.Black, 12}} --号令天下
local kefu = {{"heg_kefuzhongyuan", Card.Diamond, 1}} --克复中原
local guguo =  {{"heg_guguoanbang", Card.Heart, 1}}--固国安邦
local wenhe = {{"heg_chaos", Card.Club, 12}} --文和乱武
local zhaoshu_getCardskill = fk.CreateActiveSkill{
  name = "zhaoshu_get_card_skill",
  prompt = "#zhaoshu_get_card_skill",
  anim_type = "offensive",
  expand_pile  = "zhaoshu_user",
  can_use = function(self, player)
    local cards = player:getPile("zhaoshu_user")
    local suits = {}
    for _, id in ipairs(cards) do
      if Fk:getCardById(id).suit ~= Card.NoSuit then
        table.insertIfNeed(suits, Fk:getCardById(id).suit)
      end
    end
    return #player:getPile("zhaoshu_user") >= 4 and player:usedSkillTimes(self.name, Player.HistoryPhase) == 0 and #suits == 4 and not player.dead
  end,
  on_use = function(self, room, effect)
      local player = room:getPlayerById(effect.from)
      local card = player:getPile("zhaoshu_user")
      if #card > 0 then
      room:moveCardTo(card, Card.DiscardPile, nil, fk.ReasonPutIntoDiscardPile, self.name, "zhaoshu_user", true, player.id)
      local randoms = math.random(4)
      if randoms == 1 then --号令天下
      local haoling = U.prepareDeriveCards(room, ruleworld, "heg_rule_the_world")
      if not player.dead and table.contains({Card.Void, Card.DrawPile, Card.DiscardPile}, room:getCardArea(haoling)) then
        room:moveCardTo(haoling, Player.Hand, player, fk.ReasonPrey, self.name)
        
      end
      elseif randoms == 2 then --克复中原
        local kfzy = U.prepareDeriveCards(room, kefu, "heg_kefuzhongyuan")
        if not player.dead and table.contains({Card.Void, Card.DrawPile, Card.DiscardPile}, room:getCardArea(kfzy)) then
          room:moveCardTo(kfzy, Player.Hand, player, fk.ReasonPrey, self.name)
         
          end
        elseif randoms == 3 then --固国安邦
          local ggab = U.prepareDeriveCards(room, guguo, "heg_guguoanbang")
          if not player.dead and table.contains({Card.Void, Card.DrawPile, Card.DiscardPile}, room:getCardArea(ggab)) then
            room:moveCardTo(ggab, Player.Hand, player, fk.ReasonPrey, self.name)
           end
          else
            local whlw = U.prepareDeriveCards(room, wenhe, "heg_chaos") --文和乱武
            if not player.dead and table.contains({Card.Void, Card.DrawPile, Card.DiscardPile}, room:getCardArea(whlw)) then
              room:moveCardTo(whlw, Player.Hand, player, fk.ReasonPrey, self.name)
            end
         end
      end
  end,
}
Fk:addSkill(zhaoshu_yuan)
Fk:addSkill(zhaoshuother)
Fk:addSkill(zhaoshu_getCardskill)
Fk:loadTranslationTable{
  ["zhaoshu_get_card_skill"] = "召唤",
  [":zhaoshu_get_card_skill"] = "出牌阶段限一次，若【诏书】上有四张花色均不同的牌，你可以将【诏书】上所有的牌置入弃牌堆，然后随机获得一张势力锦囊。",
  ["#zhaoshu_get_card_skill"] = "弃置【诏书】上的所有牌并随机获得一张势力锦囊"
}

--诏书使用完后移除效果(因为使用移除)
local zhaoshuremoved = fk.CreateTriggerSkill{
  name = "zhaoshuremoved",
  global = true,
  refresh_events = {fk.BeforeCardsMove},
  can_refresh = function(self, event, target, player, data)
    if player.room:getTag("zhaoshuHasRemoved") then return false end -- 先这样，只有一次！
    if event == fk.BeforeCardsMove then
      if player.room:getTag("zhaoshuRemoved") then return false end
      for _, move in ipairs(data) do
        if move.toArea == Card.DiscardPile and move.moveReason == fk.ReasonUse then
          for _, info in ipairs(move.moveInfo) do
            if Fk:getCardById(info.cardId).name == "heg_zhaoshu" then
              return true
              end
            end
          end
        end
      end
   end,
   on_refresh = function(self, event, target, player, data)
    if event == fk.BeforeCardsMove then
      local ids = {}
      local mirror_moves = {}
      for _, move in ipairs(data) do
        if move.toArea == Card.DiscardPile and move.moveReason == fk.ReasonUse then
          local move_info = {}
          local mirror_info = {}
          for _, info in ipairs(move.moveInfo) do
            local id = info.cardId
            if Fk:getCardById(id).name == "heg_zhaoshu" then
              table.insert(mirror_info, info)
              table.insert(ids, id)
            else
              table.insert(move_info, info)
            end
          end
          if #mirror_info > 0 then
            move.moveInfo = move_info
            local mirror_move = table.clone(move)
            mirror_move.to = nil
            mirror_move.toArea = Card.Void
            mirror_move.moveInfo = mirror_info
            mirror_move.moveVisible = true
            table.insert(mirror_moves, mirror_move)
          end
        end
      end
      if #ids > 0 then
        player.room:sendLog{
          type = "#zhaoshuRemoved",
          card = ids,
          toast = true,
        }
      end
      table.insertTable(data, mirror_moves)
      player.room:setTag("zhaoshuRemoved", true)
    end
   end,
}
Fk:addSkill(zhaoshuremoved)
Fk:loadTranslationTable{
  ["#zhaoshuRemoved"] = "%card 被移出游戏",
}
--势力锦囊移除效果(因为使用移除)

local kingdomtrickremoved = fk.CreateTriggerSkill{
  name = "kingdomtrickremoved",
  global = true,
  refresh_events = {fk.BeforeCardsMove},
  can_refresh = function(self, event, target, player, data)
    if event == fk.BeforeCardsMove then
      for _, move in ipairs(data) do
        if move.toArea == Card.DiscardPile  then
          for _, info in ipairs(move.moveInfo) do
            if (Fk:getCardById(info.cardId).name == "heg_chaos") or (Fk:getCardById(info.cardId).name == "heg_rule_the_world")
            or (Fk:getCardById(info.cardId).name == "heg_kefuzhongyuan") or (Fk:getCardById(info.cardId).name == "heg_guguoanbang") then
              return true
              end
            end
          end
        end
      end
   end,
   on_refresh = function(self, event, target, player, data)
    if event == fk.BeforeCardsMove then
      local ids = {}
      local mirror_moves = {}
      for _, move in ipairs(data) do
        if move.toArea == Card.DiscardPile  then
          local move_info = {}
          local mirror_info = {}
          for _, info in ipairs(move.moveInfo) do
            local id = info.cardId
            if (Fk:getCardById(info.cardId).name == "heg_chaos") or (Fk:getCardById(info.cardId).name == "heg_rule_the_world")
            or (Fk:getCardById(info.cardId).name == "heg_kefuzhongyuan") or (Fk:getCardById(info.cardId).name == "heg_guguoanbang") then
              table.insert(mirror_info, info)
              table.insert(ids, id)
            else
              table.insert(move_info, info)
            end
          end
          if #mirror_info > 0 then
            move.moveInfo = move_info
            local mirror_move = table.clone(move)
            mirror_move.to = nil
            mirror_move.toArea = Card.Void
            mirror_move.moveInfo = mirror_info
            mirror_move.moveVisible = true
            table.insert(mirror_moves, mirror_move)
          end
        end
      end
      if #ids > 0 then
        player.room:sendLog{
          type = "#kingdomtrickRemoved",
          card = ids,
          toast = true,
        }
      end
      table.insertTable(data, mirror_moves)
    end
  end,
}
Fk:addSkill(kingdomtrickremoved)
Fk:loadTranslationTable{
  ["#kingdomtrickRemoved"] = "%card 被移出游戏",
}
--诏书不可被无懈响应
local zhaoshuxiangying = fk.CreateTriggerSkill{
  name = "zhaoshuxiangying",
  mute = true,
  global = true,
  frequency = Skill.Compulsory,
  events = {fk.CardUsing},
  can_trigger = function (self, event, target, player, data)
    return  data.card.name == "heg_zhaoshu"
  end,
  on_use = function (self, event, target, player, data)
    local room = player.room
    local targets = table.filter(room.alive_players, function(p) return p end)
    if #targets > 0 then
      data.disresponsiveList = data.disresponsiveList or {}
      for _, p in ipairs(targets) do
        table.insertIfNeed(data.disresponsiveList, p.id)
      end
    end
  end,
}
Fk:loadTranslationTable{
  ["zhaoshuxiangying"] = "诏书",
}
Fk:addSkill(zhaoshuxiangying)

return card_extension